import { Prisma } from '@prisma/client';
import { Transform } from 'class-transformer';
import { IsDefined, IsNotEmptyObject } from 'class-validator';
import { BaseDto, BaseFindDto, BaseQueryDto } from './base.dto';

export class NoticeCreateDto extends BaseDto<Prisma.NoticeCreateInput> {}

export class NoticeUpdateDto extends BaseDto<Prisma.NoticeUpdateInput> {
  @IsDefined({ message: '条件必填' })
  @IsNotEmptyObject({ nullable: false }, { message: '条件参数必填' })
  where: Prisma.NoticeWhereUniqueInput;
}

export class NoticeRemoveDto {
  @IsDefined({ message: 'ID必填' })
  @Transform(({ value }) => Number(value))
  id: number;
}

export class NoticeFindDto extends BaseFindDto<
  Prisma.NoticeWhereUniqueInput,
  Prisma.NoticeSelect
> {}

export class NoticeQueryDto extends BaseQueryDto<Prisma.NoticeWhereUniqueInput> {}

export class NoticeListDto extends BaseQueryDto<Prisma.NoticeWhereUniqueInput> {
  type?: number;
}
